package offer;

public class offerII_0068 {
    public int searchInsert(int[] nums, int target) {
        int len=nums.length;
        return search(0,len-1,nums,target);
    }
    public int search(int left,int right,int[] nums,int target){
        if(left==right){
            if(nums[left]>=target) return left;
            else return left+1;
        }
        int mid=left+(right-left)/2;
        if(nums[mid]<target) return search(mid+1,right,nums,target);
        return search(left,mid,nums,target);
    }
}
